<?php 
/**
* Specific behaviour for GET parameters
* 
* In order to generate meaningful URL's an interface is required to allow the Engine and its boxes/books
* to "register" specific extra parameters before actually using them. In this way, the Engine can
* offer default values to override unspecified parameters. Any non-registered variable is discarded and
* cannot be set.
* Also, specific engine-meaning GET parameters are read and stored in dedicated internal variables.
* Right now only the RQST get parameter is stored and can be retrieved with the specific get method.
* Also offers the 
*@package Core
*@subpackage Internals
*@author Willy Gardiol <willy@gardiol.org>
*@version 1.0
*/
class CoreParametersGet extends CoreParameters
{
	private $req_id = false;
	/**
	* Isolate specific GET variables
	*
	* Currently only identify the RQST get parameter. The parameter is stored internally and
	* removed from the $_GET array.
	*/
	public function __construct()
	{
		parent::__construct("get");
		if ( isset( $this->vars["RQST"] ) )
			$this->req_id = $this->vars["RQST"];
		unset( $this->vars["RQST"] );
	}
	/**
	* Return the RQST parameter
	*/
	public function GetReqId()
	{
		return $this->req_id;
	}
	/**
	* Register a specific GET variable
	*
	* @param string $name is the name of the variable to be registered
	* Register a new GET variable
	*/
	public function RegisterVar( $name )
	{
		if ( !isset( $this->vars[$name] ) )
			$this->vars[$name] = "var_is_uninited__";
	}
	/**
	* Format a proper GET string of all the registered and available parameters
	*
	* @param array List of values to use to fill the variables
	*/
	public function GenerateString( $temp_values )
	{
		$string = "";
		foreach ( $this->vars as $key => $value )
			if ( !isset( $temp_values[$key] ) && ($value != "var_is_uninited__") )
				$string .= "$key=$value&amp;";
			else if (isset( $temp_values[$key] ) )
				$string .= "$key=".$temp_values[$key]."&amp;";

		return $string;
	}
}
?>